package com.rainng.coursesystem.manager;

import com.rainng.coursesystem.model.bo.RegisterStatusBO;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpSession;
@Component
public class RegisterStatusManager {
    private static final String SESSION_USER_STATUS = "user_status";

    public void setRegisterStatus(HttpSession session, RegisterStatusBO registerStatus) {
        session.setAttribute(SESSION_USER_STATUS, registerStatus);
    }
    public RegisterStatusBO getRegisterStatus(HttpSession session) {
        RegisterStatusBO registerStatus = (RegisterStatusBO) session.getAttribute(SESSION_USER_STATUS);
        if (registerStatus == null) {
            registerStatus = new RegisterStatusBO();
            setRegisterStatus(session, registerStatus);
        }

        return registerStatus;
    }
}
